package com.lzm.ydpt.entity.mall;

import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.RequiresApi;

import java.util.Objects;

public class SpecBean implements Parcelable {
    private long spec_id;//": 1,
    private long base_spec_id;//": 1,
    private long goods_id;//": 1,
    private String spec_name;//: "红色"

    protected SpecBean(Parcel in) {
        spec_id = in.readLong();
        base_spec_id = in.readLong();
        goods_id = in.readLong();
        spec_name = in.readString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SpecBean)) return false;
        SpecBean specBean = (SpecBean) o;
        return goods_id == specBean.goods_id &&
                spec_id == specBean.spec_id;
    }

    @RequiresApi(api = Build.VERSION_CODES.KITKAT)
    @Override
    public int hashCode() {
        return Objects.hash(goods_id, spec_id);
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(spec_id);
        dest.writeLong(base_spec_id);
        dest.writeLong(goods_id);
        dest.writeString(spec_name);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<SpecBean> CREATOR = new Creator<SpecBean>() {
        @Override
        public SpecBean createFromParcel(Parcel in) {
            return new SpecBean(in);
        }

        @Override
        public SpecBean[] newArray(int size) {
            return new SpecBean[size];
        }
    };

    public long getSpec_id() {
        return spec_id;
    }

    public void setSpec_id(long spec_id) {
        this.spec_id = spec_id;
    }

    public long getBase_spec_id() {
        return base_spec_id;
    }

    public void setBase_spec_id(long base_spec_id) {
        this.base_spec_id = base_spec_id;
    }

    public long getGoods_id() {
        return goods_id;
    }

    public void setGoods_id(long goods_id) {
        this.goods_id = goods_id;
    }

    public String getSpec_name() {
        return spec_name;
    }

    public void setSpec_name(String spec_name) {
        this.spec_name = spec_name;
    }
}
